﻿@using System.Web.Mvc.Html
@using GameSchool.HtmlHelpers
@model GameSchool.ViewModels.Event.ListViewModel
@{
    ViewBag.Title = "Vísindaferðir";
}
<h2>
    Vísindaferðir</h2>
<p>
    Þú ávinnur þér 10 rokkstig fyrir hverja vísindaferð sem þú mætir í
</p>
@foreach (var item in Model.eventListModel)
{
    <div class="eventLine">
        <div class="row">
            <div class="span2">
                <img src="@item.LogoUrl" />
            </div>
            <div class="span6">
                <div class="row">
                    <div class="span2">
                        <h3>@item.CompanyName</h3>
                    </div>
                    <div class="span4" style="text-align: right">
                        @if (item.RegistrationEnds > DateTime.Now)
                        {
                            <p>
                                <span class="label label-success">Skráning opin í @Math.Round(item.RegistrationEnds.Subtract(DateTime.Now).TotalDays)
                                    daga og @Math.Round(item.RegistrationEnds.Subtract(DateTime.Now).TotalHours % 24)
                                    klst í viðbót</span>
                            </p>
                        }
                        else
                        {

                            <span class="label label-important">Skráningu lokið</span>
                        }
                    </div>
                </div>
                <div class="row">
                    <strong>
                        <div class="span2" style="text-align: right">
                            Staðsetning:
                        </div>
                    </strong>
                    <div class="span4">
                        @Html.DisplayFor(modelItem => item.Location)
                    </div>
                </div>
                <div class="row">
                    <strong>
                        <div class="span2" style="text-align: right">
                            Mæting:
                        </div>
                    </strong>
                    <div class="span4">
                        @Html.DisplayFor(modelItem => item.EventStarts)
                    </div>
                </div>
                <div class="row">
                    <strong>
                        <div class="span2" style="text-align: right">
                            Hámarskfjöldi:
                        </div>
                    </strong>
                    <div class="span4">
                        @Html.DisplayFor(modelItem => item.MaximumAttendees)
                    </div>
                </div>
                <div class="row">
                    <p>
                        <div class="span6">
                            @Html.DisplayFor(modelItem => item.Description)
                        </div>
                    </p>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="span8" style="text-align: right">
                @if (item.RegistrationEnds > DateTime.Now)
                {
                    <p>
                        @Html.ActionLink("Skrá mætingu", "Edit", new { eventId = item.EventID }, new { @class = "btn btn-success" })
                    </p>
                }
                else
                {
                    <span class="btn disabled">Skráningu lokið</span>
                }
            </div>
        </div>
        <div class="row">
            <div class="span8">
                <hr />
            </div>
        </div>
    </div>

}
